<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of kota
 *
 * @author user
 */
class Kota extends record{
    function __construct() {
        parent::__construct();
        $this->namaTabel = 'ongkir';
    }
    function getDataAktif(){
        $this->get();
    }
    function getBiaya($id){
        $this->get('biaya',array('id'=>$id),1);
        $ex=$this->execute();
        if($ex['success']==true){
            $biaya = $ex['result'][0]['biaya'];
        }
        else{
            $biaya=0;
        }
        return $biaya;
    }
function getCombo(){
    $strCombo = '';
    $this->get("*",array('aktif'=>1), null, null,'kota');
    $dt = $this->execute();
    if($dt['success']==false || ($dt['success']==true) && $dt['total']<1){
        $strCombo .='<option>(tidak ada data)</option>';
    }
    else{
        $strCombo .="<option></option>";
        foreach ($dt['result'] as $value) {
            $strCombo .="<option value='".$value['id']."'>".$value['kota']."</option>";
        };
    };
    return $strCombo;
}
function getData($limit = null, $start = null) {
        $this->num_rows();
        $total = $this->execute();
        $jml = ($total['success'] == true) ? $total['result'][0]['total'] : 0;
        $this->get('*', array(), $limit, $start);
        $data = $this->execute();
        $dtS = ($data['success'] == TRUE) ? $data['result'] : array();
        $return = array('total' => $jml, 'result' => $dtS);
        return $return;
    }
}

 $objKota = new Kota();